package edu.brandeis.cs.steele.util;

import java.io.IOException;
import java.util.logging.FileHandler;
import java.util.logging.Level;
import java.util.logging.Logger;
import java.util.logging.SimpleFormatter;

public class BubblerLogger {
    static Logger logger = Logger.getLogger("BubblerLog");

    static {
        try {
            FileHandler fh;
            // This block configure the logger with handler and formatter
            fh = new FileHandler(".\\log4j\\MyLogFile.log", true);
            logger.addHandler(fh);
            logger.setLevel(Level.ALL);
            SimpleFormatter formatter = new SimpleFormatter();
            fh.setFormatter(formatter);

            // the following statement is used to log any messages
            //logger.log(Level.WARNING, "My first log");

        } catch (SecurityException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static Logger getLogger() {
        return logger;
    }
}
